<?php
use yii\helpers\Url;
$this->context->layout = false;
?>
<?php
//使用率
echo $this->render("@app/views/public/useRate.php")
?>
<div id="NotRatingHistoryList"></div>
<script type="text/x-kendo-template" id="NotRatingHistoryTemplate">
    <input type="text" id="dateStart"  name="dateStart" value="<?=$date['start']?>">
    <input type="text" id="dateEnd"  name="dateEnd" value="<?=$date['end']?>">
    <span id="NotRatingHistory"></span>
</script>
<script>
    var NotRatingHistory_grid = $("#NotRatingHistoryList");
    $(document).ready(function() {
        NotRatingHistory_grid.kendoGrid({
            dataSource: {
                transport: {
                    read:function (e) {
                        $.ajax({
                            url: "<?=Url::to(['notratinghistorylist']); ?>",
                            data:{dateStart:$("#dateStart").val(),dateEnd:$("#dateEnd").val()},
                            type:"POST",
                            dataType: "json",
                            success:function (redata) {
                                e.success(redata);
                            }
                        })
                    }
                },
                schema: {
                    model: {
                        fields: {
                            created: { field:"created",type:"date"},
                            column_name: { field:"column_name"},
                            department_name: { field:"department_name"},
                            group_leader_name: { field:"group_leader_name"},
                            group_name: {field:"group_name"},
                            level1: {field:"level1"},
                            level2: {field:"level2"},
                            content: {field:"content"}
                        }
                    }
                },
                pageSize: 20
            },
            sortable: true,
            filterable: {
                extra: false,
                operators: {
                    string: {
                        contains: "包含",
                        doesnotcontain: "不包含",
                        eq: "等于",
                        neq: "不等于"
                    }
                }
            },
            toolbar:kendo.template($("#NotRatingHistoryTemplate").html()),
            pageable:{
                refresh: true,//刷新按钮
                pageSizes: [20, 40, 60, "all"],//每页数量选择
                buttonCount: 5//页码按钮数量
            },
            columns: [
                {
                    field:"created",
                    title: "美国时间" ,
                    format: "{0:MM/dd/yyyy HH:mm}",
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field: "department_name",
                    title:"部门" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field: "group_name",
                    title:"组别" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field:"group_leader_name",
                    title:"组长" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field: "name_en_long",
                    title:"组员" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field:"column_name",
                    title:"摘错/绩效" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field: "type_name",
                    title:"五大类" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field: "level1",
                    title:"错误一级类别" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                }
                ,
                {
                    field: "level2",
                    title:"错误二级类别" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                }
                ,
                {
                    field: "content",
                    title:"详情" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute,
                    width:"30%"
                }
            ]

        });
        $("#dateStart").kendoDatePicker({
            format: "yyyy/MM/dd",
            change:function(e){
                var __grid = NotRatingHistory_grid.data("kendoGrid");
                __grid.dataSource.read();
                __grid.refresh();
            }
        });
        $("#dateEnd").kendoDatePicker({
            format: "yyyy/MM/dd",
            change:function(e){
                var __grid = NotRatingHistory_grid.data("kendoGrid");
                __grid.dataSource.read();
                __grid.refresh();
            }
        });
    });
</script>
